home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / a-reatim.ads < prev    next >
Text File  |  1994-05-19  |  5KB  |  121 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --              A D A . T A S K _ I D E N T I F I C A T I O N               --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.3 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25. with System.Task_Clock;
  26.  
  27. package Ada.Real_Time is
  28.  
  29.    pragma Unimplemented_Unit;
  30.  
  31.    type Time is private;
  32.  
  33.    Time_First : constant Time;
  34.    Time_Last  : constant Time;
  35.  
  36.    Time_Unit : constant := 10#1.0#E-9;
  37.  
  38.    type Time_Span is private;
  39.  
  40.    Time_Span_First : constant Time_Span;
  41.    Time_Span_Last  : constant Time_Span;
  42.    Time_Span_Zero  : constant Time_Span;
  43.    Time_Span_Unit  : constant Time_Span;
  44.  
  45.    Tick : constant Time_Span;
  46.  
  47.    function Clock return Time;
  48.  
  49.    function "+"  (Left : Time;      Right : Time_Span) return Time;
  50.    function "+"  (Left : Time_Span; Right : Time)      return Time;
  51.    function "-"  (Left : Time;      Right : Time_Span) return Time;
  52.    function "-"  (Left : Time;      Right : Time)      return Time_Span;
  53.  
  54.    function "<"  (Left, Right : Time) return Boolean;
  55.    function "<=" (Left, Right : Time) return Boolean;
  56.    function ">"  (Left, Right : Time) return Boolean;
  57.    function ">=" (Left, Right : Time) return Boolean;
  58.  
  59.    function "+"  (Left, Right : Time_Span) return Time_Span;
  60.    function "-"  (Left, Right : Time_Span) return Time_Span;
  61.  
  62.    function "-"  (Right : Time_Span) return Time_Span;
  63.  
  64.    function "/"  (Left, Right : Time_Span) return Integer;
  65.  
  66.    function "/"  (Left : Time_Span; Right : Integer) return Time_Span;
  67.  
  68.    function "*"  (Left : Time_Span; Right : integer)   return Time_Span;
  69.    function "*"  (Left : Integer;   Right : Time_Span) return Time_Span;
  70.  
  71.    function "<"  (Left, Right : Time_Span) return Boolean;
  72.    function "<=" (Left, Right : Time_Span) return Boolean;
  73.    function ">"  (Left, Right : Time_Span) return Boolean;
  74.    function ">=" (Left, Right : Time_Span) return Boolean;
  75.  
  76.    function "abs" (Right : Time_Span) return Time_Span;
  77.  
  78.    function To_Duration  (TS : Time_Span) return Duration;
  79.    function To_Time_Span (D  : Duration)  return Time_Span;
  80.  
  81.    function Nanoseconds  (NS : Integer) return Time_Span;
  82.    function Microseconds (US : Integer) return Time_Span;
  83.    function Milliseconds (MS : Integer) return Time_Span;
  84.  
  85.    protected Delay_Object is
  86.       entry Wait (TS : Time_Span);
  87.    private
  88.    end Delay_Object;
  89.  
  90.    type Seconds_Count is range -Integer'Last .. Integer'Last;
  91.    --  Symmetrical range to avoid some overflow problems
  92.  
  93.    procedure Split (T : in Time; SC : out Seconds_Count; TS : out Time_Span);
  94.  
  95.    function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time;
  96.  
  97. private
  98.    type Time is new System.Task_Clock.Stimespec;
  99.  
  100.    Time_First : constant Time := Time (System.Task_Clock.Stimespec_First);
  101.    Time_Last  : constant Time := Time (Sustem.Task_Clock.Stimespec_Last);
  102.  
  103.    type Time_Span is new System.Task_Clock.Stimespec;
  104.  
  105.    Time_Span_First : constant Time_Span :=
  106.      Time_Span (System.Task_Clock.Stimespec_First);
  107.  
  108.    Time_Span_Last  : constant Time_Span :=
  109.      Time_Span (System.Task_Clock.Stimespec_Last);
  110.  
  111.    Time_Span_Zero  : constant Time_Span :=
  112.      Time_Span (System.Task_Clock.Stimespec_Zero);
  113.  
  114.    Time_Span_Unit  : constant Time_Span :=
  115.      Time_Span (System.Task_Clock.Stimespec_Unit);
  116.  
  117.    Ticks           : constant Time_Span :=
  118.      Time_Span (System.Task_Clock.Stimespec_Ticks);
  119.  
  120. end Ada.Real_Time;
  121.